﻿/*-------------------------------------------------------------------------
* 命名空间: XrayDirection.ValueConverters/ColorBrushConverter
* 类       名: ColorBrushConverter
* 功      能:  TD
* 时      间:  2024/1/5 17:20:40
* 版      本:  V1.0
* 作      者:  Fioman
* 格      言:  Talk is cheap,show me the code ^_^
*-------------------------------------------------------------------------*/
using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;

namespace XrayDirection.ValueConverters
{
    public class ColorBrushConverter:IValueConverter
    {
        //public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        //{
        //    throw new NotImplementedException();
        //}

        public  object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            // 如果value是布尔类型,并且是true的时候
            if (value is bool val && val)
            {
                return new SolidColorBrush(Colors.Green);
            }
            return new SolidColorBrush(Colors.Red);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
